<?php
class Application_Form_ConfigDateTimeZone extends Zend_Form
{
    public function init()
    {
       # $this->addPrefixPath('GHub_Form_Decorator', 
       #                      'GHub/Form/Decorator',
       #                      'decorator');
        $tc = Zend_Registry::get('dateTimeLocalization');
        
  	$this->addElementPrefixPath('GHub_Form_Decorator', 
                             'GHub/Form/Decorator',
                             'decorator');
  	
    	$this->setAction('/config/locale')
	 		 ->setMethod('post');

 #http://framework.zend.com/manual/en/zend.locale.appendix.html 
        
        $timeZones = new Application_Model_TimeZoneList();
        
        $tz = new Zend_Form_Element_Select('tzone');
	$tz->setLabel('Time Zone:')
		->setRequired(true)
		->addValidator('NotEmpty');
	$tzData = $timeZones->getTZList();
	$tz->addMultiOptions($tzData);
        $tz->setAttrib('class', 'textbox');
        $tz->setValue($tc->timezone);

        $flocal = new Zend_Form_Element_Select('localization');
        $flocal->setLabel('Localization:')->setRequired(true);
        $flocal->setAttrib('class', 'textbox');
        $flocal->setAttrib('style', 'width: 250px');
        $flocal->addMultiOptions($timeZones->getNativeNamesForLocales());
        $flocal->setValue($tc->localization); 
        
        $fname = new Zend_Form_Element_Text('timeformat');
        $fname->setLabel('Time format:')->setRequired(true);
        $fname->setAttrib('class', 'textbox');
        $fname->setAttrib('style', 'width: 250px');
        $fname->setValue($tc->timeformat); 
        
        $lname = new Zend_Form_Element_Text('dateformat');
        $lname->setLabel('Date format:')->setRequired(true);
        $lname->setAttrib('class', 'textbox');
        $lname->setAttrib('style', 'width: 250px');
        $lname->setValue($tc->dateformat);    
       
        $submit = new Zend_Form_Element_Button('submit');
        $submit->setValue('Submit');
        $submit->setAttrib('class', 'form-button-grey');
        $submit->setAttrib('type', 'submit');
        
 #       $reject = new Zend_Form_Element_Button('reject');
 #       $reject->setValue('Reject');
 #       $reject->setAttrib('class', 'form-button-colour');
                
        $this->addElements(array($tz,$flocal,$fname,$lname,$submit));
        
        $tz->setDecorators(array('ViewHelper',
        							'Label',
                    				array('FieldDescription', array('placement'=>'APPEND', 'text' => 'fsd sdf ss sdform-controls')),
                    				array(array('data' => 'HtmlTag'),  array('tag' =>'div', 'class'=> 'field')),
                    				array('FieldsetLegend', array('placement'=>'PREPEND', 'text' => 'Date and Time')))
                    			   );
                    			   
        $lname->setDecorators(array('ViewHelper',
        							'Label',
        							array('FieldDescription',array('placement'=>'APPEND', 'text' => 'ffsff ntrols')),
                    				array(array('data' => 'HtmlTag'),  array('tag' =>'div', 'class'=> 'field')),
                    				array('FieldsetLegend', array('placement'=>'APPEND')))
                    			   );                   			   
                  			   
#FOR ONE BUTON:        
   #     $submit->setDecorators(array('ViewHelper',
   #    	 	array(array('data' => 'HtmlTag'),  array('tag' =>'div', 'class'=> 'form-controls'))
   #     ));
#FOR MORE BUTTONS 

        $submit->setDecorators(array('ViewHelper',
       	 	array('ButtonsWraper',array('placement'=>'PREPEND', 'cssclass' => 'form-controls'))
        ));
        
   #     $reject->setDecorators(array('ViewHelper',
   #    	 	array('ButtonsWraper',array('placement'=>'APPEND'))
   #     ));        			   
                    			   
        $this->setDecorators(array('FormElements',
        array('Form',array('class' =>'standard-form standard-form-small'))));
	return $this;
    }
}


